package app;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.net.URI;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import KUtilities.KAbout;
import KUtilities.KSpringOld;

public class About extends KAbout {
	private static final long serialVersionUID = 1L;

	public JPanel aboutApp() {
		JPanel aboutPanel=new JPanel();
		aboutPanel.setOpaque(false);
		KSpringOld aboutSpring=new KSpringOld(aboutPanel);
		
		final JLabel heading,appName,appDescription,report;
		final JButton gcode,fb;
		
		heading=new JLabel("Press Escape to Exit");
		appName=new JLabel("SMS Desktop App v2.1.7");
		appDescription=new JLabel("      ($_$) Send SMS Directly from Your PC");
		report=new JLabel("Report any Errors:");
		gcode=new JButton("On Official Code Hosting");
		fb=new JButton("On Facebook Page");
		
		Toolkit tk = Toolkit.getDefaultToolkit();
	    Image hand = tk.getImage("lib"+File.separator+"images"+File.separator+"hand.gif");
		Cursor handCursor= tk.createCustomCursor(hand, new Point(10,7), "Hand");
				
		fb.setCursor(handCursor);
		gcode.setCursor(handCursor);
		heading.setForeground(Color.yellow);
		heading.setFont(heading.getFont().deriveFont(heading.getFont().getSize2D()+10));
		appName.setForeground(Color.green);
		appDescription.setForeground(Color.white);
		report.setForeground(Color.yellow);
		
		gcode.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent ae){
				if(Desktop.isDesktopSupported()){
					try {
						Desktop.getDesktop().browse(new URI("http://code.google.com/p/ninja-sms-app/issues/list"));
					} catch (Exception e) {}
				}
			}
		});
		
		fb.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent ae){
				if(Desktop.isDesktopSupported()){
					try {
						Desktop.getDesktop().browse(new URI("http://www.facebook.com/pages/SMS-Desktop-App/274880162524616"));
					} catch (Exception e) {}
				}
			}
		});
		
		aboutSpring.add(heading,appName,appDescription,report,gcode,fb);
		aboutSpring.setHGap(5, aboutPanel,appDescription,aboutPanel);
		aboutSpring.setVGap(5, aboutPanel,heading,appName,appDescription,report,gcode,fb,aboutPanel);
		aboutSpring.alignLeft(heading,appName,appDescription,report,gcode,fb);
		
		return aboutPanel;
	}

}
